﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="AddRecipe.aspx.vb" Inherits="mybaconrecipe.AddRecipe" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1 style="margin-bottom:0px;">
        <asp:Label ID="AddRecTitle" runat="server"></asp:Label>
    </h1>
    <div id="FullPaneNoBorder">
        <table cellpadding="0" cellspacing="0" class="frmTable">
            <!-- 1. RECIPE DETAILS -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        1. Recipe Details</h2>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Recipe Name *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeName" runat="server" CssClass="textEntry"></asp:TextBox>
                </td>
                <td class="val_frmTable">
                    <asp:RequiredFieldValidator ID="vldReq_RecipeName" runat="server" ErrorMessage="You must provide the name of this recipe" SetFocusOnError="True" ControlToValidate="tb_RecipeName"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Type of Recipe *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:DropDownList ID="ddl_RecipeType" runat="server" DataSourceID="SqlDataSource1"
                        DataTextField="TYPE_DESC" DataValueField="TYPE_ID" CssClass="textEntry">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                        ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT [TYPE_DESC], [TYPE_ID] FROM [TYPE]">
                    </asp:SqlDataSource>
                </td>
                <td class="val_frmTable">
                    
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Bacon Rating *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:RadioButtonList ID="rbl_RecipeStars" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem>1</asp:ListItem>
                        <asp:ListItem>2</asp:ListItem>
                        <asp:ListItem>3</asp:ListItem>
                        <asp:ListItem>4</asp:ListItem>
                        <asp:ListItem>5</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td class="val_frmTable">
                    <asp:RequiredFieldValidator ID="vldReq_Rating" runat="server" ErrorMessage="You must give an initial rating to this recipe" SetFocusOnError="True" ControlToValidate="rbl_RecipeStars"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Serves *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeServes" runat="server" CssClass="textEntrySm"></asp:TextBox>
                    people
                </td>
                <td class="val_frmTable">
                    <asp:RequiredFieldValidator ID="vldReq_Serves" runat="server" ErrorMessage="You must state the number of people that this recipe serves" SetFocusOnError="True" ControlToValidate="tb_RecipeServes"></asp:RequiredFieldValidator><br />
                    <asp:RegularExpressionValidator ID="vldNum_Serves" runat="server" ControlToValidate="tb_RecipeServes" ErrorMessage="Only numeric values are allowed" ValidationExpression="^[+-]?\d+(\.\d+)?$"></asp:RegularExpressionValidator>                
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Preparation Time *
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeTime" runat="server" CssClass="textEntrySm"></asp:TextBox>
                    minutes
                </td>
                <td class="val_frmTable">
                    <asp:RequiredFieldValidator ID="vldReq_Time" runat="server" ErrorMessage="You must say how long it takes to prepare this recipe" SetFocusOnError="True" ControlToValidate="tb_RecipeTime"></asp:RequiredFieldValidator><br />
                    <asp:RegularExpressionValidator ID="vldNum_Minutes" runat="server" ControlToValidate="tb_RecipeTime" ErrorMessage="Only numeric values are allowed" ValidationExpression="^[+-]?\d+(\.\d+)?$"></asp:RegularExpressionValidator> 
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    Short Description
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeDescription" runat="server" CssClass="textEntrySm" TextMode="MultiLine"></asp:TextBox>
                </td>
                <td class="val_frmTable">
                    
                </td>
            </tr>
            <!-- 2. TAG RECIPE -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        2. Tag This Recipe</h2>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable" colspan="2" style="padding-bottom:10px">
                    Choose any of our existing tags:
                </td>
            </tr>
            <tr>
                <td colspan="2" class="inp_frmTable">
                    <asp:CheckBoxList ID="chk_RecipeTag" runat="server" DataSourceID="tagsDataSource"
                        DataTextField="TAG" DataValueField="TAG_ID" RepeatDirection="Horizontal">
                    </asp:CheckBoxList>
                    <asp:SqlDataSource ID="tagsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                        ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT [TAG_ID], [TAG] FROM [TAG]">
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td class="lbl_frmTable">
                    Or add your own tags (separated by a comma)
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable">
                    <asp:TextBox ID="tb_RecipeNewTags" runat="server" CssClass="textEntry"></asp:TextBox>
                </td>
                <td class="val_frmTable">
                    
                </td>
            </tr>

            <!-- 3. INGREDIENTS -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        3. Ingredients</h2>
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable" colspan="2">
                    <asp:GridView ID="grd_Ingredients" runat="server" AutoGenerateColumns="False" DataKeyNames="ING_ID" CssClass="grd_AddRecipeIngredients">
                        <Columns>
                            <asp:BoundField DataField="ING_QTY" HeaderText="ING_QTY" SortExpression="ING_QTY" />
                            <asp:BoundField DataField="ING_DESC" HeaderText="ING_DESC" SortExpression="ING_DESC" />
                        </Columns>
                        <HeaderStyle CssClass="notVis" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="IngDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                        ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [INGREDIENT]">
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <div class="div_Qty">Quantity: <asp:TextBox ID="ing_Qty" runat="server" CssClass="textEntrySm"></asp:TextBox></div>
                    <div class="div_Ing">Ingredient: <asp:TextBox ID="ing_Desc" runat="server" CssClass="textEntry"></asp:TextBox></div>
                    <div class="div_Btn"> <asp:Button ID="btn_AddToIngredients" runat="server" Text="+" CssClass="btn_FormAlt" ToolTip="Press To Add Ingredient To Recipe" /></div>
                </td>
            </tr>


            <!-- 4. METHOD -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        4. Cooking Instructions</h2>
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable" colspan="2">
                    <asp:GridView ID="grd_Method" runat="server" AutoGenerateColumns="False" DataKeyNames="METHOD_ID" CssClass="grd_AddRecipeIngredients">
                        <Columns>
                            <asp:BoundField DataField="METHOD_DESC" HeaderText="METHOD_DESC" SortExpression="METHOD_DESC" />
                        </Columns>
                        <HeaderStyle CssClass="notVis" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                        ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [METHOD]">
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    Instruction: <asp:TextBox ID="meth_Desc" runat="server" CssClass="textEntry" style="width:463px;"></asp:TextBox> <asp:Button ID="btn_AddToMethods" runat="server" Text="+" CssClass="btn_FormAlt" ToolTip="Press To Add Method To Recipe" />
                </td>
            </tr>


            <!-- 4. MEDIA GALLERY -->
            <tr>
                <td class="lbl_frmTable" colspan="2">
                    <h2>
                        4. Photo Gallery</h2>
                </td>
            </tr>
            <tr>
                <td class="inp_frmTable" colspan="2">
                    <asp:GridView ID="grd_Gallery" runat="server" AutoGenerateColumns="False" AutoGenerateSelectButton="True" CssClass="grd_AddRecipeGallery" SelectedRowStyle-BackColor="#DDDDDD">
                        <Columns>
                            <asp:BoundField DataField="GALLERY_ID" HeaderText="" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_ID" />
                            <asp:ImageField DataImageUrlField="GALLERY_PATH" HeaderText="">
                                <ControlStyle CssClass="RecListThumb" />
                            </asp:ImageField>
                            <asp:BoundField DataField="GALLERY_SIZE" HeaderText="Size (bytes)" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_SIZE" />
                            <asp:BoundField DataField="GALLERY_WIDTH" HeaderText="Width (px)" InsertVisible="False"
                                ReadOnly="True" SortExpression="GALLERY_WIDTH" />
                            <asp:BoundField DataField="GALLERY_HEIGHT" HeaderText="Height (px)" InsertVisible="False"
                                ReadOnly="False" SortExpression="GALLERY_HEIGHT" />
                        </Columns>
                        <HeaderStyle CssClass="grd_AddRecipeGalleryHeader" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="galleryDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                        ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT [GALLERY_ID], [GALLERY_PATH], [RECIPE_ID], [GALLERY_TEMP] FROM [GALLERY] WHERE ([GALLERY_TEMP] = ?)">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="True" Name="GALLERY_TEMP" Type="Boolean" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td colspan="2" class="inp_frmTable">
                    <asp:FileUpload ID="fup_Gallery" runat="server" CssClass="textEntry" Width="535px" />
                    <asp:Button ID="btn_AddToGallery" runat="server" Text="+" CssClass="btn_FormAlt" />
                </td>
            </tr>
            <tr>
                <td class="btn_frmTable" colspan="2">
                    <asp:Button ID="btn_AddRecipe" runat="server" Text="Save Recipe" CssClass="btn_Form" />
                </td>
            </tr>
        </table>
</asp:Content>
